//
//  AppDelegate.m
//  Demo4
//
//  Created by cora1n on 14-8-21.
//  Copyright (c) 2014年 devwu. All rights reserved.
//

#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 80, 320, 320)];
    
    //image只是一个用于加载图片的类,本质存储的是二进制信息
    UIImage * image = [UIImage imageNamed:@"car1.tiff"];
    //imageView负责将image中的二进制信息渲染到屏幕
    [imageView setImage:image];
    
    NSMutableArray* images = [NSMutableArray array];
    for (int i = 1; i<=6; i++) {
        NSString* iamgeStr = [NSString stringWithFormat:@"car7.tiff",i];
        UIImage * i = [UIImage imageNamed:iamgeStr];
        [images addObject:i];
    }
    //设置imageView的图片集合
    [imageView setAnimationImages:images];
    //设置动画的持续时间,imageView中的图片将会在指定的持续时间内播放完成
    [imageView setAnimationDuration:0.001];
    //设置重复次数,默认为0,表示无限重复
//    [imageView setAnimationRepeatCount:100];
    //开始动画
    [imageView startAnimating];
    
    [self.window addSubview:imageView];
    
    
    return YES;
}

@end
